module("Class", package.seeall )

DEBUG = false

List = {}

SCOUT 		= 	1
SOLDIER 	= 	2
SNIPER 		= 	3
ENGINEER 	= 	4
ROCKET 		= 	5

local BaseClass = {
	Id = -1,
	Name = "Unkown",
	Description = "Unkown",
	Player = nil, //Store the player value
	Init = function( self  )
		//Called when a new player chooses the class
	end,
	SetAmmo = function( self ) end,
	Spawn = function( self )
		//Give the weapons to the player
	end
}
local BaseClassMeta = {
	__index = BaseClass
}

function Exists( class )
	return List[ class ] != nil
end

function GetPlayerClassId( ply )
	return ply:GetInfoNum("nc_class")
end

function Register( class )
	if List[ class.Id ] then
		ErrorNoHalt("Registering two classes with id " .. tostring(class.Id) )
	end
	
	setmetatable( class, BaseClassMeta )

	List[ class.Id ] = class
end 

function New( ply, class )
	
	if !List[ class ] then
		Error("Could not find class of id '" .. tostring(class) .. "'" )
	end
	
	local NewClass = {
		Player = ply
	}
	
	setmetatable( NewClass, {
		__index = List[ class ] 
	} )
	
	NewClass:Init()
	
	return NewClass
	
end

if SERVER then
	AddCSLuaFile("sh_classlist.lua")
end

include("sh_classlist.lua")